package models;

import play.db.jpa.Model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Пользователь
 *
 * User: Администратор
 * Date: 11.06.12
 * Time: 15:36
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "users")
public class User extends Model {

    @Column(unique = true, length = 255)
    public String email;
    public String password;
    public String role;
    public String name;
    public String surname;
    public String secondName;
    public String position;

    public User() {
    }

    public User(String email, String password, String name, String surname, String secondName, String position) {
        this.name = name;
        this.surname = surname;
        this.secondName = secondName;
        this.email = email;
        this.password = password;
        this.position = position;
    }

    public static User connect(String email, String password) {
        return find("byEmailAndPassword", email, password).first();
    }

}
